﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml.Linq;
using System.Linq;

namespace ArmoryBrowser.Entities.Achievements
{
    public class Summary
    {
        #region Fields
        private CategoryData _categoryDataField;
        private Category[] _categoriesField;
        private Achievement[] _achievementsField;
        #endregion
        #region Properties
        public CategoryData CategoryData
        {
            get
            {
                return this._categoryDataField;
            }
            set
            {
                this._categoryDataField = value;
            }
        }
        public Category[] Categories
        {
            get
            {
                return this._categoriesField;
            }
            set
            {
                this._categoriesField = value;
            }
        }
        public Achievement[] Achievements
        {
            get
            {
                return this._achievementsField;
            }
            set
            {
                this._achievementsField = value;
            }
        }
        #endregion
        #region Constructor
        public Summary(XElement element)
        {
            CategoryData = element.Elements("c").Select(e => new CategoryData(e)).FirstOrDefault();
            Categories = element.Elements("category").Select(e => new Category(e)).ToArray();
            Achievements = element.Elements("achievement").Select(e => new Achievement(e)).ToArray();
        }
        #endregion
    }
}
